package pers.qianyu.month_202011.date_20201123;

/**
 * 70. 爬楼梯
 * https://leetcode-cn.com/problems/climbing-stairs/
 *
 * @author mizzle rain
 * @date 2020-11-23 17:59
 */
public class ClimbStairs {
    public int climbStairs(int n) {
        if (n < 2) {
            return n;
        }
        int[] dp = new int[n];
        dp[0] = 1;
        dp[1] = 2;
        for (int i = 2; i < n; i++) {
            dp[i] = dp[i - 1] + dp[i - 2];
        }
        return dp[n - 1];
    }
}
